<!-- Discription: 首页, author: ydj, Date: 2021-07-12 10:01:46 -->
<template>
  <div>
    <HelloWorld msg="Hello Vue 3 + TypeScript + Vite" />
    <el-button @click="addCount">count is: {{ count }}</el-button>
  </div>
</template>

<script lang='ts'>
import { ref, defineComponent, reactive, computed } from "vue";
import HelloWorld from "@/components/HelloWorld.vue";
import { useStore } from "../../store";
export default defineComponent({
  name: "App",
  components: {
    HelloWorld,
  },
  setup: () => {
    const store = useStore();
    const count: any = computed({
      get() {
        return store.state.app.count;
      },
      set(val) {
        store.commit("increment", val);
      },
    });
    function addCount() {
      count.value += 1;
    }
    return {
      count,
      addCount,
    };
  },
});
</script>
<style lang='scss' scoped>
</style>
